home *** CD-ROM | disk | FTP | other *** search
- /*
- * vdi.c
- * Hilfs-Routinen rund um das VDI.
- */
-
- #include "intern.h"
-
- int open_vwork(int *w_out)
- {
- int handle;
- int work_in[11] = {1,1,1,1,1,1,1,1,1,1,2};
-
- handle = gl_phys_handle;
- v_opnvwk(work_in, &handle, w_out);
- return handle;
- }
-
-
- void set_clipping(int handle, int x, int y, int w, int h, int on)
- {
- int clip[4];
-
- clip[0] = x;
- clip[1] = y;
- clip[2] = clip[0]+w-1;
- clip[3] = clip[1]+h-1;
- vs_clip(handle, on, clip);
- }
-
-
- /*
- * Point-Höhe zu einer Pixel-Höhe ermitteln.
- */
- int height2pts(int handle, int f_id, int f_height)
- {
- int d, w, h, asked, got, width, height;
- int pt = -1;
-
- vst_font(handle, f_id);
- vst_height(handle, f_height, &d, &height, &width, &d);
- asked = 99;
- got = asked;
- while (got <= asked)
- {
- /*
- * Schleife, solange ein kleinerer Font eingestellt werden kann;
- * Abbruch, wenn vst_point() einen /größeren/ Font als angefordert
- * einstellt (und somit auch als tatsächliche Größe zurückliefert)
- */
- asked = got - 1; /* 1 kleiner als aktuelle Größe einstellen */
- got = vst_point(handle, asked, &d, &h, &w, &d);
- if ((h == height) && (w == width))
- {
- pt = got; /* Punktgröße gefunden */
- break;
- }
- }
- return pt;
- }
-
- #ifndef __MINT__
- /*
- * Kennt die Pure/GEM-Lib nicht.
- */
- static VDIPB vdipb = {_VDIParBlk.contrl,
- _VDIParBlk.intin,
- _VDIParBlk.ptsin,
- _VDIParBlk.intout,
- _VDIParBlk.ptsout};
-
- int vdi_str2array(char *src, int *des)
- {
- int len;
- unsigned char *c;
-
- len = 0;
- c = (unsigned char*)src;
- while (*c != '\0')
- {
- *des++ = *c++;
- len++;
- }
- return len;
- }
-
- void vqt_real_extent(int handle, int x, int y, char *string, int extent[])
- {
- int i;
-
- i = vdi_str2array(string, _VDIParBlk.intin);
- _VDIParBlk.ptsin[0] = x;
- _VDIParBlk.ptsin[1] = y;
- _VDIParBlk.contrl[0] = 240;
- _VDIParBlk.contrl[1] = 1;
- _VDIParBlk.contrl[3] = i;
- _VDIParBlk.contrl[6] = handle;
- vdi(&vdipb);
- for (i = 0; i<8; i++)
- extent[i] = _VDIParBlk.ptsout[i];
- }
-
- #endif
-